﻿// ***************************************************************
//  memory   version:  1.0   ·  date: 05/25/2010
//  -------------------------------------------------------------
//  
//  -------------------------------------------------------------
//  Copyright (C) 2010 - All Rights Reserved
// ***************************************************************
// 
// ***************************************************************
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#ifndef ccs_util_memory_h__
#define ccs_util_memory_h__

#include <boost/pool/object_pool.hpp>


template<typename ObjType>
inline void delete_object(ObjType* p)
{
#ifdef ccs_validate_memory_manager
	// pool manager
#else // ccs_validate_memory_manager
	delete p;
#endif // ccs_validate_memory_manager
}

template<typename ObjType>
inline void delete_object_array(ObjType* p)
{
#ifdef ccs_validate_memory_manager
	// pool manager
#else // ccs_validate_memory_manager
	delete [] p;
#endif // ccs_validate_memory_manager
}

#define ccs_new(var_type) new var_type()
#define ccs_new_args(var_type, args) new var_type(args)
#define ccs_new_array(var_type, nElem) new var_type[nElem]

#define ccs_delete(pt) delete_object(pt)
#define ccs_delete_array(pt) delete_object_array(pt)

#endif /*ccs_util_memory_h__*/